//
//  ChouCell.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/3/3.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#define LuColor [UIColor colorWithHexString:@"#53b279"]
#import "ChouCell.h"

@implementation ChouCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
         [self createUI];
        UILabel *orageLab = [[UILabel alloc] init];
        orageLab.backgroundColor = OverColor;
        [self addSubview:orageLab];
        [orageLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(3, 45));
            make.left.mas_equalTo(self.mas_left).offset(1);
            make.top.equalTo(self.mas_top).offset(7);
            
        }];
        _photoImg= [[UIImageView alloc] init];
        _photoImg.image = [UIImage imageNamed:@"nanshihui"];
        [self addSubview:_photoImg];
        [_photoImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(17);
            make.top.equalTo(self.mas_top).offset(10);
            make.left.equalTo(self.mas_left).offset(10);
        }];
       
        _nameLab = [[UILabel alloc] init];
        _nameLab.text = @"耶律花花";
        _nameLab.textColor = OverColor;
        _nameLab.font = [UIFont systemFontOfSize:14];
        [self addSubview:_nameLab];
        [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(60, 16));
            make.left.equalTo(_photoImg.mas_right).offset(6);
            make.top.mas_equalTo(self.mas_top).offset(12);
        }];
        
        _shiLab = [[UILabel alloc] init];
        _shiLab.textColor = [UIColor blackColor];
        _shiLab.text = @"认筹时间 | 2016-10-29";
        _shiLab.font = [UIFont systemFontOfSize:10];
        [self addSubview:_shiLab];
        [_shiLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(130, 14));
            make.left.equalTo(_nameLab.mas_right).offset(10);
            make.top.equalTo(self.mas_top).offset(13);
        }];
        
        
        _vipLab = [[UILabel alloc] init];
        _vipLab.text = @"VIP 120";
        _vipLab.textColor = [UIColor colorWithHexString:@"#53b279"];
        _vipLab.font = [UIFont systemFontOfSize:10];
        [self addSubview:_vipLab];
        [_vipLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(40, 14));
            make.left.equalTo(self.mas_left).offset(15);
            make.top.equalTo(self.mas_top).offset(40);
        }];
        
        _haoLab = [[UILabel alloc] init];
        _haoLab.text = @"| 市场排号 |";
        _haoLab.textColor = [UIColor colorWithHexString:@"#53b279"];
        _haoLab.font = [UIFont systemFontOfSize:10];
        [self addSubview:_haoLab];
        [_haoLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(60, 14));
            make.left.equalTo(_vipLab.mas_right).offset(5);
            make.top.equalTo(self.mas_top).offset(40);
        }];
        
        _jiaoLao = [[UILabel alloc] init];
        
        _jiaoLao = [[UILabel alloc] init];
        _jiaoLao.text = @"已成交";
        _jiaoLao.textColor = [UIColor colorWithHexString:@"#53b279"];
        _jiaoLao.font = [UIFont systemFontOfSize:10];
        [self addSubview:_jiaoLao];
        [_jiaoLao mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(60, 14));
            make.left.equalTo(_haoLab.mas_right).offset(5);
            make.top.equalTo(self.mas_top).offset(40);
        }];
        
        _messageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _messageBtn.layer.cornerRadius = 15;
        [_messageBtn setImage:[UIImage imageNamed:@"xinxi"] forState:0];
        [_messageBtn addTarget:self action:@selector(messageBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_messageBtn];
        [_messageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(35);
            make.top.equalTo(self.mas_top).offset(15);
            make.right.equalTo(self.mas_right).offset(-70);
        }];
        
        _callBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _callBtn.layer.cornerRadius = 15;
        [_callBtn setImage:[UIImage imageNamed:@"dianhuatubiao"] forState:0];
        [_callBtn addTarget:self action:@selector(callBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_callBtn];
        [_callBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(35);
            make.top.equalTo(self.mas_top).offset(15);
            make.right.equalTo(self.mas_right).offset(-20);
        }];
        
    }
    return self;
}













//重点在这里
- (void)createUI{
    //创建一个UIView比self.contentView小一圈
    self.bgView  = [[UIView alloc] initWithFrame:CGRectMake(0,5, [[UIScreen mainScreen] bounds].size.width, 54)];
    self.bgView.backgroundColor = [UIColor whiteColor];
    //给bgView边框设置阴影
    self.bgView.layer.shadowOffset = CGSizeMake(2,2);
    self.bgView.layer.shadowOpacity = 0.8;
    self.bgView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    [self.contentView addSubview:self.bgView];
}

#pragma mark 按钮的点击事件
-(void)messageBtnClick:(UIButton *)btn
{
    
}

-(void)callBtnClick:(UIButton *)btn
{
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
